---
title: Data model
summary: Persistence model, entity mappings, and stored procedure usage for SAIF.Services.WCF.Host.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-22
---

# Data model

This host interacts with entities across four connections spanning two database platforms — Oracle `CLM`, `IMG`, and `EXTUR`, and SQL Server `NETFRAMEWORK`/`APPM` — accessed exclusively through NHibernate `IRepository<T>` operations (`Query()`, `Add()`, `Delete()`) and one framework repository call (`GetNextImageId()`). No stored procedure, PL/SQL package call, or raw ADO.NET command is used anywhere in this host's source.

## Connections

Connection strings are not declared in configuration. Each connection is composed at run time — see [Configuration](configuration.md) for the resolution call, environment config key, and pool code.

**The pool code is not the Oracle/SQL Server schema.** Each value below (`CLM`, `IMG`, `EXTUR`, `NETFRAMEWORK`/`APPM`) is a SAIF-specific identifier forwarded to a legacy connect-info service that resolves the actual database user/schema server-side; that schema is not visible from application source and is reported as unknown in the domain tables below rather than guessed from the pool code's spelling.

| Connection | Pool code | Access method | Purpose |
| --- | --- | --- | --- |
| Oracle `CLM` | `CLM` | NHibernate `IRepository<Preference>` over `OracleUnitOfWorkFactory` | `PreferenceService` persistence |
| Oracle `IMG` | `IMG` | NHibernate `IRepository<Image>` over `OracleUnitOfWorkFactory` | `ImagingService` image id reservation |
| Oracle `EXTUR` | `EXTUR` | NHibernate `IRepository<T>` over `OracleUnitOfWorkFactory` | `SecurityService`/`UserFactory` user and employee resolution |
| SQL Server `NETFRAMEWORK` / `APPM` | `NETFRAMEWORK` / `APPM` | NHibernate `IRepository<WebContextItem>` over `SqlServerUnitOfWorkFactory` | `WebContextService` persistence |

## Preferences domain (pool code `CLM`)

| Table | Schema | Owner library | Owner class | CRUD | SQL docs | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `Preference` (entity) | Unknown — resolved server-side (pool code `CLM`) | `SAIF.Services.WCF.Host` | `PreferenceService` | C, R, U, D | Not determined from source | Accessed via `IRepository<Preference>.Query()`/`.Add()`/`.Delete()`; no raw table name observed beyond the entity mapping |

## Session-context domain (pool codes `NETFRAMEWORK`/`APPM`, SQL Server)

| Table | Schema | Owner library | Owner class | CRUD | SQL docs | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `WebContextItem` (entity) | Unknown — resolved server-side (pool code `APPM`) | `SAIF.Services.WCF.Host` | `WebContextService` | C, R, D | Not determined from source | Session-context rows are deleted on first read (consume-once semantics); see [Operations and processes](operations-processes.md) |

## Imaging domain (pool code `IMG`)

| Table | Schema | Owner library | Owner class | CRUD | SQL docs | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `Image` (entity) | Unknown — resolved server-side (pool code `IMG`) | `SAIF.Framework.Data.NHibernate` | `ImagingService` | C, R | Not determined from source | `ReserveImageId` calls `unitOfWork.GetRepository<Image>().GetNextImageId()`, a framework repository method, not a raw table read |

## Identity and employee domain (pool code `EXTUR`)

| Table | Schema | Owner library | Owner class | CRUD | SQL docs | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `Employee` (entity, ADP) | Unknown — resolved server-side (pool code `EXTUR`) | `SAIF.Services.WCF.Host` | `UserFactory` | R | Not determined from source | Resolved via `IRepository<Employee>`; active only when the employee status code is exactly `A` |
| `WcisEmployee` (entity) | Unknown — resolved server-side (pool code `EXTUR`) | `SAIF.Services.WCF.Host` | `UserFactory` | R | Not determined from source | Resolved via `IRepository<WcisEmployee>` |
| `ExternalUser` (entity) | Unknown — resolved server-side (pool code `EXTUR`) | `SAIF.Services.WCF.Host` | `UserFactory` | R | Not determined from source | Resolved via `IRepository<ExternalUser>` |
| `ExternalUserType` (entity) | Unknown — resolved server-side (pool code `EXTUR`) | `SAIF.Services.WCF.Host` | `UserFactory` | R | Not determined from source | Resolved via `IRepository<ExternalUserType>` |
| `Person`, `Phone`/`Address` (entities) | Unknown — resolved server-side (pool code `EXTUR`) | `SAIF.Services.WCF.Host` | `ContactFactory` | R | Not determined from source | Contact projection consumed by `UserFactory` at five call sites |

## Entity mappings

Not in this repository — the `FluentNHibernate` `ClassMap` types for `Preference`, `WebContextItem`, `Image`, `Employee`, `WcisEmployee`, `ExternalUser`, `ExternalUserType`, `Person`, and the contact types are supplied by the external `SAIF.Framework.Data.NHibernate` / `SAIF.Data.Model` closure and are not present in this host's source tree.

## Stored procedures

No stored procedures or PL/SQL packages are referenced by this service; all database access is through NHibernate mappings and queries. A recursive search of every `.cs` file under `src/WCF/SAIF.Services.WCF.Host/` for `GetNamedQuery(`, `CreateSqlQuery(`, `ExecuteNonQuery`, `SqlCommand`, `OracleCommand`, and `SAIFConnection` returned zero matches.

## Named queries

No NHibernate named queries are defined by this host's source; the search described above found none.

## Message types and persisted entities

| Message type | Used by | Persisted entity | Mapping |
| --- | --- | --- | --- |
| `Preference` | [`GetPreferences`](contracts/preference-service.md#getpreferences), [`SavePreferences`](contracts/preference-service.md#savepreferences) | `Preference` | Direct entity round-trip through `IRepository<Preference>` |
| `WebContextItem` | [`Get`](contracts/web-context-service.md#get), [`Save`](contracts/web-context-service.md#save), [`CreateContext`](contracts/web-context-service.md#createcontext) | `WebContextItem` | Direct entity round-trip through `IRepository<WebContextItem>`; `Get` deletes the row it reads |
| Reserved image id (`int`) | [`ReserveImageId`](contracts/imaging-service.md#reserveimageid) | None — projection only | `IRepository<Image>.GetNextImageId()` returns a scalar sequence value, not an `Image` entity |
| Resolved user/employee projections | [`GetUser`](contracts/security-service.md#getuser), [`GetSaifUserByUserId`](contracts/security-service.md#getsaifuserbyuserid), [`GetSaifUserByEmployeeId`](contracts/security-service.md#getsaifuserbyemployeeid), [`GetExternalUser`](contracts/security-service.md#getexternaluser), [`GetExternalUserByCustomerId`](contracts/security-service.md#getexternaluserbycustomerid), [`GetInjuredWorkerUserByCustomerId`](contracts/security-service.md#getinjuredworkeruserbycustomerid) | `Employee`, `WcisEmployee`, `ExternalUser`, `ExternalUserType`, `Person` | `UserFactory` projects one or more `EXTUR` entities into the external `SAIF.Services.WCF.Contracts` user type returned to the caller* |

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Activation and hosting](activation-hosting.md)
- [Operations](operations.md)
- [Faults and error pipeline](faults.md)
- [Authentication and authorization](authentication-authorization.md)
- [Dependencies](dependencies.md)
- [Configuration](configuration.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Operational runbook](operational-runbook.md)
- [Tech debt](tech-debt.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs
- src/WCF/SAIF.Services.WCF.Host/Services/WebContextService.cs
- src/WCF/SAIF.Services.WCF.Host/Services/ImagingService.cs
- src/WCF/SAIF.Services.WCF.Host/Services/Security/Users/UserFactory.cs
- src/WCF/SAIF.Services.WCF.Host/Services/Security/Users/ContactFactory.cs
